<template>
  <page-wrap stay-still :bgColor="topBg" hideTab :dark="false" back hideSafeArea title="活动详情">
    <view class="transfer">
      <view class="progress">
        <u-line-progress active-color="#58c2fc" :percent="67"></u-line-progress>
        正在进入活动详情...
      </view>
    </view>
  </page-wrap>
</template>
<script>
import WxLoginMixin from "@/mixins/wxLogin";
import { checkEnroll } from "@/api/modules/zph";

export default {
  mixins: [WxLoginMixin],
  data() {
    return {
      personId: uni.getStorageSync("person-id").slice(2) || undefined,
      topBg: `url(${this.$imgBaseSelf}home/top_bg.png)`,
      showForm: false,
      name: "",
      school: "",
      major: "",
      activityId: "2031721125699544", // 招聘会id
      enrollStatus: "", // 是否报名活动，1是，0否
    };
  },
  created() {
    if (this.personId) {
      this.checkEnroll();
    } else {
      this.handleToIndex();
    }
  },
  methods: {
    checkEnroll() {
      uni.showLoading();
      const params = {
        activityId: this.activityId,
        personId: this.personId,
      };
      checkEnroll(params).then((res) => {
        uni.hideLoading();
        if (res.code == 200) {
          this.enrollStatus = res.data.enrollStatus;
          if (this.enrollStatus == 1) {
            uni.redirectTo({
              url: "/pagesSub/careerGrow/zph/detail?activityId="+this.activityId,
            });
          } else {
            this.handleToIndex();
          }
        } else {
          this.handleToIndex();
        }
      });
    },
    handleToIndex() {
      uni.redirectTo({
        url: "/pagesSub/activity/sxh/index",
      });
    }
  },
};
</script>
<style lang="scss" scoped>
.transfer {
  height: 1375rpx;
  padding-top: 544rpx;
  background-image: url($img-base + "zph/sxh/bg.png");
  background-size: 100%;
  background-repeat: no-repeat;

  .progress {
    margin: 100rpx;
    color: #ffffff;
    text-align: center;
  }
}

</style>